package day03.`match`

import scala.util.Random

object MatchType {
  def main(args: Array[String]): Unit = {
    val arr = Array("abcde",100,3.14,true,new MatchClass)
    val element = arr(Random.nextInt(arr.length))

    println(element)

    element match {
      case str:String => println(s"match String:$str")
      case int:Int => println(s"match Int:$int")
//      case dou:Double => println(s"match Double:$dou")
      case bool:Boolean => println(s"match Boolean:$bool")
      case matchClass:MatchClass => println(s"match MatchClass:$matchClass")
      case _:Any => println(s"Not matched")
    }
  }
}

class MatchClass{

}